% the zoh system
close all
clear all


Z.A = 1;
Z.B = 1;
Z.C = 1;
Z.D = 0;
Z.umin = -1;
Z.umax = 1;
Z.xmin = -4;
Z.xmax = 4;
prob.norm = 2;
prob.Q =2;
prob.R = 1;
prob.N = 2;
prob.Tconstraint = 0;
prob.subopt_lev = 0;
ctrlQ2R1 = mpt_control(Z,prob);
prob.Q = 1;
prob.R = 2;
ctrlQ1R2 = mpt_control(Z,prob);
subplot(2,1,2)
mpt_plotU(ctrlQ2R1)
title('Control signal for Q=2, R=1')
subplot(2,1,1)
mpt_plotU(ctrlQ1R2)
title('Control signal for Q=1, R=2')

%figure
%mpt_plotPartition(ctrl)
%figure
%mpt_plotU(ctrl)
%figure
%mpt_plotTimeTrajectory(ctrl, 1)
